<template>
	<view class="box">
		<view class="content u-m-tb-30">
			关注公众号体验更加哦~确保可收到重要推送消息，（如果使用该小程序前您已经关注过公众号了，请先取消关注，扫码二维码再进行关注）
		</view>
		<view class="img" @longpress="handleLongPress(url)">
			<image :src="url" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: ''
			};
		},
		onLoad() {

			this.getoffice()
		},
		methods: {
			// 长按识别二维码
			 handleLongPress (e)  {
				uni.previewImage({
					urls: [e], 
					longPressActions: {
						itemList: ['发送给朋友', '保存图片', '收藏'],
						success: (res) => {
							console.log(res);
						},
						fail: (res) => {
							console.log(res.errMsg);
						}
					}
				})
			},

			getoffice() {
				this.$api.post('/user/getwayticket', {}).then(res => {
					this.url = res.data
				})
			},
		}
	}
</script>

<style lang="scss">
	.box {
		width: 686rpx;
		height: 100vh;
		margin: 0 auto;
		position: relative;

		.content {
			text-align: center;
			color: red;
		}

		.img {
			width: 686rpx;
			position: absolute;
			left: 50%;
			transform: translateX(-50%);
		}
	}
</style>